package main;

import net.fkrahe.graph.WLinkedGraph;
import net.fkrahe.graph.WLinkedGraphException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author fkrahe
 */
public class Main {

    public static void main(String[] args) {
        /**
         * WLinkedGraph testing
         */
        System.out.println("/**");
        System.out.println(" * WLinkedGraph testing");
        System.out.println(" */");
        WLinkedGraph graph = new WLinkedGraph();
        System.out.println("Inserting node 1");
        GraphNodeForTesting node1 = new GraphNodeForTesting(3, "#1");
        graph.add(node1);
        System.out.println("Inserting node 2");
        GraphNodeForTesting node2 = new GraphNodeForTesting(4, "#2");
        graph.add(node2);
        System.out.println("Inserting node 3");
        GraphNodeForTesting node3 = new GraphNodeForTesting(3, "#3");
        graph.add(node3);
        System.out.println("Joining nodes 1 and 2");
        graph.join(node1, node2, 7);
        System.out.println("Joining nodes 1 and 3");
        graph.join(node1, node3, 5);
        System.out.println("Graph is:");
        System.out.println(graph.toString());
        try {
            System.out.println("Splitting nodes 1 and 2");
            graph.remove(node1, node2);
        } catch (WLinkedGraphException ex) {
            Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
        }
        System.out.println("Graph is:");
        System.out.println(graph.toString());

    }
}
